using Samples.MetaContainer.MoneyExchangeSample.ContainerAbstraction;
using Samples.MetaContainer.MoneyExchangeSample.DomainModel.Services;

namespace Samples.MetaContainer.MoneyExchangeSample.DomainModel
{
    public class Order
    {
        private readonly string _currency;
        private readonly double _value;

        public Order(string currency, double value)
        {
            _currency = currency;
            _value = value;
        }

        public double GetValue()
        {
            if (_currency == "PLN")
                return _value;

            IMoneyExchange me = ContextContainer.Current.GetInstance<IMoneyExchange>();
            return me.Change(_currency, "PLN", _value);
        }

    }
}